<script>
/**
 * 招商业绩编辑
 * @Author Mumu xinglinhe@qq.com
 * @Date 2022/09/13
 */
export default{
	components:{

	},
	props:{

	},
	data(){
		return {
			visible:false,
			data:{},
			loading:false,
		}
	},
	created(){},
	mounted(){},
	methods:{
		send(){
			this.$refs.forms.validate().then(async ()=>{
				this.loading=true;
				let rs = await this.muajax.fodSave({
					...this.data,
				});
				this.loading=false;
				if(rs.status==200){
					this.$message.success(rs.msg);
					this.visible=false;
					this.$emit("update_list");
				}
			}).catch(err=>{
				console.log('验证不通过');
				// this.$errorFocus(err);
			})
		},
		async datainit(){
			let rs = await this.muajax.fodGet({ id : this.param.id});
			if(rs.status==200){
				this.data=rs.data;
			}
		},//初始化本页数据
		show(show,param){
			this.visible=show; 
			if(param) {
				if(show){
					this.param=param;
					if(!!this.param?.id)
						this.datainit();
				}
			} else {
				this.data=[{}];
			}
		},

	},
	computed:{},
	watch:{},
	filters:{},
}
</script>
<template>
	<a-modal
		v-model:visible="visible" 
		destroyOnClose
		width="500px"
		title="区域编辑"
		:maskClosable="false"
		@ok="send"
		cancelText="取消"
		okText="提交"
		:confirmLoading="loading"
	>
		<a-form
		ref="forms"
		:model="data"
		>
			<a-form-item
				label="地点"
				:labelCol="{span: 7}"
				name="address"
				:rules="[{required:true,message:'请输入地点'}]"
			>
				<a-input
					placeholder="请输入"
					v-model:value="data.address"
				/>
			</a-form-item>

			<a-form-item
				label="经度"
				:labelCol="{span: 7}"
				name="latitude"
				:rules="[{required:true,message:'请输入经度'}]"
			>
				<a-input
					placeholder="请输入经度"
					v-model:value="data.latitude"
				/>
			</a-form-item>

			<a-form-item
				label="维度"
				:labelCol="{span: 7}"
				name="longitude"
				:rules="[{required:true,message:'请输入维度'}]"
			>
				<a-input
					placeholder="请输入"
					v-model:value="data.longitude"
				/>
			</a-form-item>
		</a-form>
	</a-modal>
</template>
<style lang="less" scoped>

</style>